<div class="page-header">
    <h1>{$data.art_title} <small>{$data.art_nicktitle}</small></h1>
</div>
<div class="art-content">
    {$data.art_content}
    <div class="comment-editor">
        <h4>如果你有什么需要提问或者疑问，可以在下面留言[请文明留言]</h4>
        <div id="editor">
        </div>
        <textarea id="cmmcontent" style="display:none" name="content"></textarea>
        <div class="comment-submit">                            
            <a href="javascript:app.submit();" class="btn btn-primary">确定</a>
        </div>
        <hr />
    </div>
</div>
<div class="comment">
    {volist name="comments" id="cmm"}
    <div class="comment-list">
        <div class="cmm-avater"><img src="/home/images/default.png" /></div>
        <div class="cmm-content">
            <div class="cmm-createtime">{$cmm.cmm_createtime|date="Y-m-d",###}：</div>
            <div class="cmm-text">{$cmm.cmm_content}</div>
        </div>
    </div>
    <hr />
    <div class="clearfix"></div>
    {/volist}
</div>

<script type="text/javascript">
 (function(){
     var E = window.wangEditor
     var content = '';
     var editor = new E('#editor')
     editor.customConfig.onchange = function (html) {
         content = html;
     } 
     editor.create();     
     var submit = function(){
         var id = {$data.art_id};
         temp = content.replace(/<\/?.+?>/g,"");
         if(temp == ''){
             $("#msg-modal").modal('show').on('shown.bs.modal',function(){
                 $(this).find('.modal-body').html("你没有输入内容");
             });
         }else{
             $.ajax({
                 type : "post",
                 url:"addcomment.html",
                 data : {'id':id,'content':content},
                 dataType: 'json',
                 success : function(res){
                     $("#msg-modal").modal('show').on('shown.bs.modal',function(e){
                         $(this).find('.modal-body').html(res.msg+"（可以再点击课程，即可看到留言）");
                     }).on('hidden.bs.modal',function(){
                         $(this).find('.modal-body').html('');
                     });                     

                 }
             })
         }

     }
     return app.submit = submit;
 }())
</script>
</div>
<div class="modal fade" tabindex="-1" role="dialog" id="msg-modal">
    <div class="modal-dialog" role="document">
        <div class="modal-content">
            <div class="modal-header">
                <h4 class="modal-title"><i class="fa fa-warning"></i> 提示：</h4>
            </div>
            <div class="modal-body">

            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
            </div>
        </div>
    </div>
</div>
<script type="text/javascript">    
 SyntaxHighlighter.highlight();  
</script>  
